package com.hy.hywebview.webviewprocess.webchromeclient

import android.util.Log
import android.webkit.ConsoleMessage
import android.webkit.WebChromeClient
import android.webkit.WebView
import com.hy.hywebview.webviewprocess.webviewclient.WebViewCallBack

/**
 * @Description:自定义WebChromeClient
 * @Author: wdk
 * @CreateTime: 2024/4/13 17:46
 */
class HYWebChromeClient(private val mWebViewCallBack: WebViewCallBack) : WebChromeClient() {
    companion object {
        private const val TAG = "HYWebChromeClient"
    }

    override fun onReceivedTitle(view: WebView?, title: String?) {
        mWebViewCallBack.updateTitle(title ?: "")
    }


    override fun onConsoleMessage(consoleMessage: ConsoleMessage?): Boolean {
        Log.d(TAG, "onConsoleMessage: ${consoleMessage?.message()}")
        return super.onConsoleMessage(consoleMessage)
    }

}